package com.tanhua.model.vo;

import com.tanhua.model.domain.Announcement;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.text.SimpleDateFormat;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AnnouncementsVo {

    private String id;
    private String title;
    private String description;
    private String createDate;

    public static AnnouncementsVo init(Announcement item) {
        AnnouncementsVo vo = new AnnouncementsVo();
        BeanUtils.copyProperties(item, vo);
        vo.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(item.getCreated()));
        return vo;
    }
}